define(function(require,exports,module){
	
	var tpl = require('../../tpl/member_guarantee/compensatory_compensatoryList.tpl');//载入tpl模板
	//初始化显示表格、搜索
	require.async(['./showTable','./search'],function(showTable,search){
		showTable.ajaxUrl('/member_guarantee/compensatory/getCompensatedList.html?time=-1',tpl);
		search.search('/member_guarantee/compensatory/getCompensatedList.html?',tpl);
	});	

	//代偿详情弹窗
	$('.replaceDetails').live('click',function(){
	var id = $(this).attr("data-val");
	   require.async(["/plugins/layer-v1.8.4/skin/layer.css","/plugins/layer-v1.8.4/layer.min.js"],function(){
			$.layer({
				type: 1,
				closeBtn: [0,true],
				title: "&nbsp;&nbsp;",
				area: ['874px', '220px'],
				border: [1, 1, '#cecfd0'],
				page: {
				    html: '<div class="tipsWrap w794"><table class="table table-bordered"><thead><tr><th>代偿日期</th><th>代偿本金</th><th>代偿利息</th><th>代偿罚息</th><th>代偿总额</th></tr></thead><tbody id="transferingDetailTable"></tbody></table></div>'
				},
				success:function(){
					$.ajax({
						url:"/member_guarantee/compensatory/compensatoryDetail.html?id=" + id + "&randomTime=" + (new Date()).getTime(),
						type:"get",
						dataType:"json",
						success:function(json){
							$("#transferingDetailTable").html(Handlebars.compile(require("../../tpl/member_guarantee/compensatory_detail.tpl"))(json));
						}
					})
				}
			});
		});	
	})
    

});